<?php
class PageStyle1 extends AbsPageStyle {
	public function html() {
		$html = '';
		$cfg = Page::$cfg;
		$curPageNum = PageUtil::getCurrentPageNum();
		$totalPage = PageUtil::getTotalPage();
		//如果页码大于1，则显示‘首页’，‘上一页’
		if($curPageNum > 1) {
			$html .= str_replace('{href}', PageUtil::getPageUrl(1), $cfg['firstPage']);
			$html .= str_replace('{href}', PageUtil::getPageUrl($curPageNum - 1), $cfg['prePage']);
		}
		
		//显示当前页码
		$html .= str_replace(array('{pageNum}', '{totalNum}'), array($curPageNum, $totalPage), $cfg['nowPage']);
		
		//如果页码小于总页数，则显示‘下一页’，‘尾页’
		if($curPageNum < $totalPage) {
			$html .= str_replace('{href}', PageUtil::getPageUrl($curPageNum + 1), $cfg['nextPage']);
			$html .= str_replace('{href}', PageUtil::getPageUrl($totalPage), $cfg['lastPage']);
		}
		
		return $html;
	}
}
?>